<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>watch</title>
  <script type="text/javascript" src="../vue.js"></script>
</head>

<body>
  <div id="app">

    <div>
      <form action="javascript:">
        <button @click="sor">升序</button>
        <button @click="sor">降序</button>
        <input type="text" v-model="search">
        <section>
          <option v-for=" item in newperson" :key="item.id">{{item.name}}--{{item.age}}</option>
        </section>
      </form>
    </div>

  </div>
</body>
<script type="text/javascript">
  Vue.config.productionTip = false;
  const vm = new Vue({
    el: "#app",
    data() {
      return {
        search: "",
        persons: [
          { id: '001', name: '马冬梅', age: 19, gender: '女' },
          { id: '002', name: '周冬雨', age: 20, gender: '女' },
          { id: '003', name: '周杰伦', age: 21, gender: '男' },
          { id: '004', name: '帅邓伦', age: 22, gender: '男' },
        ],
        type: 0
      }
    },
    methods:{
      sor(){
        
      }
    },
    computed: {
      newperson(value) {
        return this.persons.filter((item) => {
          return item.name.includes(this.search)
        })
      }
    }
  })
</script>

</html>